package reflect;

import reflect.annotation.AutoRunClass;
import reflect.annotation.AutoRunMethod;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class cls=Class.forName("reflect.Person");
        Method method=cls.getDeclaredMethod("sayHello");
        if(method.isAnnotationPresent(AutoRunMethod.class)){
            AutoRunMethod an=method.getAnnotation(AutoRunMethod.class);
           int value= an.value();
            System.out.println("参数value的值为："+value);
        }

    }
}
